package com.dullfox.sbm.controller;

import com.dullfox.sbm.common.auth.AuthIgnore;
import com.dullfox.sbm.common.auth.AuthManager;
import com.dullfox.sbm.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Author: zengdy
 * Date: 2018/10/25
 */
@Controller
@RequestMapping(value = "/")
public class IndexController {

    @Autowired
    private AuthManager authManager;

    @PostMapping(value = "/")
    @AuthIgnore
    public String inde() {
        SysUser sysUser = authManager.getUser();
        if (sysUser == null) {
            return "/login";
        }
        return "redirect:/index";
    }

    @PostMapping(value = "/index")
    @AuthIgnore
    public String index() {
        return "/index";
    }

}
